package com.atbeijing.gmall.mapper;

import com.atbeijing.gmall.bean.KeywordStats;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface KeywordStatsMapper {

    @Select("select keyword,sum(keyword_stats_1116.ct *multiIf(source = 'SEARCH', 10, source = 'ORDER', 3, source = 'CART', 2, source = 'CLICK', 1, 0)) ct from keyword_stats_1116 where toYYYYMMDD(stt) = #{date} group by keyword order by ct limit #{limit};")
    List<KeywordStats> selectKeyWord(Integer date , Integer limit);
}
